package com.ruoyi.srmcontract.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.srmcontract.domain.JacContractItemtoerp;
import com.ruoyi.srmcontract.service.IJacContractItemtoerpService;
import com.ruoyi.srmcontract.utils.MyUtils;

/**
 * ERP合同中间 提供者
 * 
 * @author ygx
 * @date 2020-08-18
 */
@RestController
@RequestMapping("itemtoerp")
public class JacContractItemtoerpController extends MyUtils
{
	
	@Autowired
	private IJacContractItemtoerpService jacContractItemtoerpService;
	
	/**
	 * 查询${tableComment}
	 */
	@GetMapping("get/{contractcode}")
	public JacContractItemtoerp get(@PathVariable("contractcode") String contractcode)
	{
		return jacContractItemtoerpService.selectJacContractItemtoerpById(contractcode);
		
	}
	
	/**
	 * 查询ERP合同中间列表
	 */
	@GetMapping("list")
	public R list(JacContractItemtoerp jacContractItemtoerp)
	{
		startPage();
        return result(jacContractItemtoerpService.selectJacContractItemtoerpList(jacContractItemtoerp));
	}
	
	
	/**
	 * 新增保存ERP合同中间
	 */
	@PostMapping("save")
	public R addSave(@RequestBody JacContractItemtoerp jacContractItemtoerp)
	{		
		return toAjax(jacContractItemtoerpService.insertJacContractItemtoerp(jacContractItemtoerp));
	}

	/**
	 * 修改保存ERP合同中间
	 */
	@PostMapping("update")
	public R editSave(@RequestBody JacContractItemtoerp jacContractItemtoerp)
	{		
		return toAjax(jacContractItemtoerpService.updateJacContractItemtoerp(jacContractItemtoerp));
	}
	
	/**
	 * 删除${tableComment}
	 */
	@PostMapping("remove")
	public R remove(String ids)
	{		
		return toAjax(jacContractItemtoerpService.deleteJacContractItemtoerpByIds(ids));
	}
	
}
